import { loginWxMinSimple, getMemberProfile } from "@/http/profile";
export default {
    namespaced: true,
    state: {
        profile: null,
        memberProfile: null
    },
    getters: {},
    mutations: {
        setProfile(state, data) {
            state.profile = data
        },
        setMemberProfile(state, data) {
            state.memberProfile = data
        }
    },
    actions: {
        async fetchProfile({ commit }, phoneNumber) {
            const res = await loginWxMinSimple(phoneNumber)
            commit("setProfile", res.result)
        },
        // 会员信息
        async fetchMemberProfile({ commit }) {
            const res = await getMemberProfile()
            commit("setMemberProfile", res.result)
            return { ...res.result }
        }
    }
}